package com.jlz.actions.console.division;

import org.apache.struts2.convention.annotation.Standard;
import org.springframework.beans.factory.annotation.Autowired;

import com.jlz.beans.def.DivisionBean;
import com.jlz.managers.def.Divisions;
import com.julewa.LOG;

@Standard(rest="division.ID")
public class SaveAction {

	@Autowired Divisions divisions;
	private @Autowired DivisionBean division;
	private static LOG log = new LOG(SaveAction.class);
	
	public String execute(){
		if(division.getID()==null){
			//新增子节点，parentid已经通过隐藏域传进来
			divisions.insert(division);
			log.info("增加了"+division.getLabel());
			
		}else{
			divisions.update(division);
			log.info("修改了"+division.getLabel());
		}
		return "division";
	}

	public void setDivision(DivisionBean division) {
		this.division = division;
	}

	public DivisionBean getDivision() {
		return division;
	}
	
}
